//
//  discoverImageCell.m
//  Focus
//
//  Created by xwc on 14-11-4.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "discoverImageCell.h"
#import "UIImageView+WebCache.h"

@implementation discoverImageCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        UIImageView *titleImageView = [[UIImageView alloc] init];
        self.titleImageView = titleImageView;
        [titleImageView release];
        [self.contentView addSubview:self.titleImageView];
        
        UILabel *imageTitleLable = [[UILabel alloc] init];
        self.imageTitleLable = imageTitleLable;
        self.imageTitleLable.textColor = [UIColor whiteColor];
        self.imageTitleLable.font = [UIFont systemFontOfSize:18];
        [imageTitleLable release];
        [self.contentView addSubview:self.imageTitleLable];
       
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.titleImageView.frame = self.contentView.bounds;
    self.imageTitleLable.frame = CGRectMake(0, self.contentView.frame.size.height - 50, self.contentView.frame.size.width, 50);
}

- (void)setDiscoverModel:(discoverTitleModel *)discoverModel
{
    if (_discoverModel != nil) {
        [_discoverModel release];
        _discoverModel = [discoverModel retain];
    }
    self.titleImageView.frame = self.contentView.bounds;
    self.imageTitleLable.frame = CGRectMake(0, self.contentView.frame.size.height - 50, self.contentView.frame.size.width, 50);
    
    if (discoverModel.titleImageStr == nil) {
        self.titleImageView.image = [UIImage imageNamed:@"backgrand.jpg"];
    } else {
        
        [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:discoverModel.titleImageStr]];
        self.imageTitleLable.text = discoverModel.imageTitleStr;
    }
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect
 {
 // Drawing code
 }
 */

@end
